﻿@{
    Layout = null;
}
<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>物控系统</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="shortcut icon" href="~/Content/X-admin/images/icony.png" />
    <link href="~/Content/X-admin/css/loginn.css" rel="stylesheet" />
    <link href="~/Content/X-admin/css/font.css" rel="stylesheet" />
    <script src="~/Content/X-admin/lib/layui/layui.js"></script>
    <link href="~/Content/X-admin/css/xadmin.css" rel="stylesheet" />
    <script src="~/Content/X-admin/js/jquery.min.js"></script>
    <script src="~/Content/X-admin/js/xadmin.js"></script>
    <script src="~/Content/Scripts/System/systemFrame.js"></script>
</head>
<body class="login-bg">
    <div class="main">
        <div class="layui-col-md12">
            <img id="title" src="../Content/X-admin/images/icony.png">
            <span>
                &nbsp;&nbsp;&nbsp;&nbsp;用信息技术推动经济发展和社会进步！
            </span>
        </div>
        <div class="row">
            <div class="layui-carousel" id="images">
                <div carousel-item>
                    <div><img src="~/Content/X-admin/images/bg1.jpg" /></div>
                    <div><img src="~/Content/X-admin/images/bg5.jpg" /></div>
                </div>
            </div>
            <div class="layui-col-md7">
            </div>
            <div class="layui-col-md4">
                <div class="login ">
                    <form id="dForm" name="dForm" class="layui-form layui-col-space5">
                        <h1 class="title">
                            <span>账号登录</span>
                        </h1>
                        <hr class="hr20">
                        <select name="baseCode" class="SelectPaymentMode" multiple></select>
                        <hr class="hr15">
                        <input name="userCode" placeholder="用户名" type="text" lay-verify="required" class="layui-input">
                        <hr class="hr15">
                        <input name="userPwd" lay-verify="required" placeholder="密码" type="password" class="layui-input">
                        <hr class="hr15">
                        <input value="登录" lay-submit lay-filter="login" style="width:100%;" type="button" onclick="login()">
                        <hr class="hr20">
                    </form>
                </div>
            </div>
        </div>

        <div class="layui-col-md11">
            <span>
                技术支持:0312-6779383
                &nbsp;&nbsp;&nbsp;&nbsp;
                河北增昀网络科技有限公司
            </span>
        </div>

    </div>
</body>

</html>
<script type="text/javascript">
    $(function () {
        getBaseInfo();
        //InService();
        $(document).keyup(function (event) {
            if (event.keyCode == 13) {
                login();
            }
        })

    })

    layui.use('carousel', function () {
        var carousel = layui.carousel;
        //建造实例
        carousel.render({
            elem: '#images'
            , width: '100%' //设置容器宽度
            , height: '100%' //设置容器高度
            //, full:'true' //是否全屏轮播,默认false
            // , arrow: 'always' //始终显示箭头和点击按钮
            // ,anim: 'updown' //切换动画方式，可从各个方向滚动
        });
    });

    //登录方法
    function login() {
        $.ajax({
            url: "../System/login",
            data: JSON.stringify(FormToJson("dForm")),
            dataType: "json",
            type: "POST",
            success: function (data) {
                if (data.Result) {
                    //alert(data.Message)
                    //layer.msg(data.Message, { icon: 6, time: 2000 });\
                    if (data.Message != null) {
                        layer.open({
                            type: 0, //默认就是0，所以可以省略
                            title: "系统提示",
                            content: data.Message,
                            btn: ['确定'],
                            yes: function (index, layero) {
                                window.location.href = "../System/Index";//确定按钮跳转地址
                            },
                            //btn2: function (index, layero) {
                            //    self.location = 'http://www.163.com';//取消按钮跳转地址
                            //},
                            cancel: function (index, layero) { //按右上角“X”按钮跳转地址
                                window.location.href = "../System/Index";
                            },
                        })
                    } else {
                        window.location.href = "../System/Index";
                    }
                    
                    //window.location.href = "../System/Index";
                } else {
                    layer.msg(data.Message);
                }
            }
        });
    }

    function getBaseInfo() {
        $.ajax({
            url: "../System/getCustomBaseByCode",
            dataType: "json",
            type: "POST",
            success: function (data) {
                if (data.Result) {
                    var datas = data.Data;
                    for (var i = 0; i < datas.length; i++) {
                        var contents = "";
                        contents += "<option value=\"" + datas[i]["DbCode"] + "\" ";
                        if (datas[i]["isDefault"] == "Y") {
                            contents += " selected";
                        }
                        contents += ">" + datas[i]["customName"] + "</option>";
                        $(".SelectPaymentMode").append(contents);
                    }
                    if (datas.length < 1) {
                        $(".SelectPaymentMode").append("<option value='' >请选择</option>");
                    }
                    layui.use('form', function () {
                        var form = layui.form;
                        form.render();

                        //  $("#orgCode").val(['5']).trigger("change");

                    });
                }
            }
        });
    }

</script>